#pragma once

#include <AVUIViewBase.h>

namespace AVUI {

class GridViewColumnCollection;
class GridViewHeaderRowPresenter;
class Style;
class DataTemplate;
class DataTemplateSelector;

class GridView : public ViewBase
{
    friend class GridViewHeaderRowPresenter;
public:
    GridView() : m_pColumns(NULL), m_pHeaderRowPresenter(NULL) { };

    DECLARE_ELEMENT(GridView, ViewBase);

    DECLARE_DEPENDENCY_PROPERTY(ColumnCollection);

    DECLARE_DEPENDENCY_PROPERTY(ColumnHeaderContainerStyle);
    TRefCountedPtr<Style> get_ColumnHeaderContainerStyle() { return (Style*)(Object*)GetValue(get_ColumnHeaderContainerStyleProperty()); }
    void set_ColumnHeaderContainerStyle(Style* pValue) { SetValue(get_ColumnHeaderContainerStyleProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(ColumnHeaderTemplate);
    TRefCountedPtr<DataTemplate> get_ColumnHeaderTemplate() { return (DataTemplate*)(Object*)GetValue(get_ColumnHeaderTemplateProperty()); }
    void set_ColumnHeaderTemplate(DataTemplate* pValue) { SetValue(get_ColumnHeaderTemplateProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(ColumnHeaderTemplateSelector);
    TRefCountedPtr<DataTemplateSelector> get_ColumnHeaderTemplateSelector() { return (DataTemplateSelector*)(Object*)GetValue(get_ColumnHeaderTemplateSelectorProperty()); }
    void set_ColumnHeaderTemplateSelector(DataTemplateSelector* pValue) { SetValue(get_ColumnHeaderTemplateSelectorProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(AllowsColumnReorder);
    bool get_AllowsColumnReorder() { return AVUI::UnboxValue<bool>(GetValue(get_AllowsColumnReorderProperty())); }
    void set_AllowsColumnReorder(bool value) { SetValue(get_AllowsColumnReorderProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(ColumnHeaderContextMenu);
    TRefCountedPtr<Object> get_ColumnHeaderContextMenu() { return GetValue(get_ColumnHeaderContextMenuProperty()); }
    void set_ColumnHeaderContextMenu(Object* pValue) { SetValue(get_ColumnHeaderContextMenuProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(ColumnHeaderToolTip);
    TRefCountedPtr<Object> get_ColumnHeaderToolTip() { return GetValue(get_ColumnHeaderToolTipProperty()); }
    void set_ColumnHeaderToolTip(Object* pValue) { SetValue(get_ColumnHeaderToolTipProperty(), (Object*)pValue); } 

    IMPLEMENT_READONLY_REFERENCE_PROPERTY(Columns, GridViewColumnCollection, true);
    GridViewColumnCollection* get_Columns();

protected:

    virtual void ClearItem(ListViewItem* pItem);
    virtual void PrepareItem(ListViewItem* pItem);

private:
    static void StaticConstructor();

    void set_HeaderRowPresenter(GridViewHeaderRowPresenter* pHeaderPresenter) { m_pHeaderRowPresenter = pHeaderPresenter; }

    TRefCountedPtr<GridViewColumnCollection> m_pColumns;
    GridViewHeaderRowPresenter* m_pHeaderRowPresenter;
};

 


}; // namespace AVUI

